import balloon
from XendError import XendError
from XendLogging import log
-
+from XendDomainInfo import DEV_MIGRATE_STEP1, DEV_MIGRATE_STEP2
+from XendDomainInfo import DEV_MIGRATE_STEP3
SIGNATURE = "LinuxGuestRecord"
XC_SAVE = "xc_save"
dominfo.setName('migrating-' + domain_name)
try:
- dominfo.migrateDevices(live, dst, 1, domain_name)
+ dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP1, domain_name)
write_exact(fd, pack("!i", len(config)),
"could not write guest state file: config len")
log.debug("Suspending %d ...", dominfo.getDomid())
dominfo.shutdown('suspend')
dominfo.waitForShutdown()
- dominfo.migrateDevices(live, dst, 2, domain_name)
+ dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP2,
+ domain_name)
log.info("Domain %d suspended.", dominfo.getDomid())
- dominfo.migrateDevices(live, dst, 3, domain_name)
+ dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP3,
+ domain_name)
tochild.write("done\n")
tochild.flush()
log.debug('Written done')
ZOMBIE_PREFIX = 'Zombie-'
+"""Constants for the different stages of ext. device migration """
+DEV_MIGRATE_TEST = 0
+DEV_MIGRATE_STEP1 = 1
+DEV_MIGRATE_STEP2 = 2
+DEV_MIGRATE_STEP3 = 3
+
"""Minimum time between domain restarts in seconds."""
MINIMUM_RESTART_TIME = 20
@raise: XendError for a device that cannot be migrated
"""
for (n, c) in self.info['device']:
- rc = self.migrateDevice(n, c, live, dst, 0)
+ rc = self.migrateDevice(n, c, live, dst, DEV_MIGRATE_TEST)
if rc != 0:
raise XendError("Device of type '%s' refuses migration." % n)
from xen.xend.XendLogging import log
from xen.xend.XendError import XendError
from xen.xend import XendRoot
+from xen.xend.XendDomainInfo import DEV_MIGRATE_TEST
from xen.xend.server.DevController import DevController
log.info("Request to live-migrate device to %s. step=%d.",
dst, step)
- if step == 0:
+ if step == DEV_MIGRATE_TEST:
"""Assuming for now that everything is ok and migration
with the given tool can proceed.
"""
for line in fd.readlines():
mo = re.search('Error', line)
if mo:
- raise XendError("vtpm: Fatal error in migration step %d." %
- step)
+ raise XendError("vtpm: Fatal error in migration step %d: %s" %
+ (step, line))
return 0
else:
log.debug("External migration tool not in configuration.")